package support;

import machine.WashingMachine;

import components.Programator;

public class User implements iDoLoundry {

	@Override
	public void switchOnWashingMaschine(WashingMachine washingMachine) {
		System.out.println("Switching on washing machine! ");
		washingMachine.turnOn();

	}

	@Override
	public void setProgram(Program program, WashingMachine washingMachine) {

		System.out.println("Setting Program.\n" + "Program: " + program.name());
		washingMachine.getProgramator().setProgram(program);

	}

	@Override
	public void switchOffWashingMaschine(WashingMachine washingMachine) {
		System.out.println("Switching off washing machine!");
		washingMachine.turnOff();
	}

	@Override
	public void loadLoundry(int amount, WashingMachine washingMachine) {
		System.out.println("Loading loundry: " + amount);
		washingMachine.getDrum().setLoad(amount);
		washingMachine.getDrum().setDoorsClosed(true);
	}

	@Override
	public void addPowder(int amount, WashingMachine washingMachine) {
		// TODO Auto-generated method stub

	}

	@Override
	public void startWashingMachine(WashingMachine washingMachine) {
		System.out.println("Starting Washing machine");
	}

	public void doLoundry(WashingMachine washingMachine) {
		switchOnWashingMaschine(washingMachine);
		loadLoundry(5, washingMachine);
		setProgram(Program.COLOUR_LOUNDRY, washingMachine);
		washingMachine.startWashingMachine(new WashingCycle(washingMachine));
		switchOffWashingMaschine(washingMachine);

	}

}
